<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>草料二维码生成器</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/daisyui/4.12.10/full.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
        }
        .glass-card {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        .qr-container {
            min-height: 300px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    </style>
</head>
<body class="flex items-center justify-center p-4">
    <div class="container mx-auto max-w-2xl">
        <div class="glass-card rounded-2xl p-8 shadow-2xl">
            <h1 class="text-3xl font-bold text-white text-center mb-8">
                <i class="fas fa-qrcode mr-2"></i>
                草料二维码生成器
            </h1>
            
            <form id="qrForm" class="space-y-6">
                <div>
                    <label class="block text-white text-sm font-medium mb-2">
                        <i class="fas fa-link mr-1"></i>
                        网址或文本内容
                    </label>
                    <input 
                        type="text" 
                        id="urlInput" 
                        class="w-full px-4 py-3 rounded-lg bg-white/20 border border-white/30 text-white placeholder-white/70 focus:outline-none focus:ring-2 focus:ring-white/50"
                        placeholder="https://example.com 或任意文本内容"
                        required
                    >
                </div>
                
                <div>
                    <label class="block text-white text-sm font-medium mb-2">
                        <i class="fas fa-palette mr-1"></i>
                        模板ID（可选）
                    </label>
                    <input 
                        type="text" 
                        id="mhidInput" 
                        class="w-full px-4 py-3 rounded-lg bg-white/20 border border-white/30 text-white placeholder-white/70 focus:outline-none focus:ring-2 focus:ring-white/50"
                        placeholder="sELAVNMfK8k"
                        value="sELAVNMfK8k"
                    >
                    <p class="text-white/70 text-xs mt-1">
                        使用默认模板即可，如需自定义样式可修改模板ID
                    </p>
                </div>
                
                <button 
                    type="submit" 
                    class="w-full bg-white/20 hover:bg-white/30 text-white font-bold py-3 px-6 rounded-lg transition duration-300 border border-white/30"
                >
                    <i class="fas fa-magic mr-2"></i>
                    生成二维码
                </button>
            </form>
            
            <div id="loading" class="hidden text-center py-8">
                <div class="inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-white"></div>
                <p class="text-white mt-2">正在生成二维码...</p>
            </div>
            
            <div id="result" class="hidden">
                <div class="qr-container mt-8">
                    <img id="qrImage" class="max-w-full h-auto rounded-lg shadow-lg" alt="二维码">
                </div>
                <div class="mt-4 text-center">
                    <button 
                        id="downloadBtn"
                        class="bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded-lg transition duration-300"
                    >
                        <i class="fas fa-download mr-2"></i>
                        下载二维码
                    </button>
                </div>
            </div>
            
            <div id="error" class="hidden mt-4 p-4 bg-red-500/20 border border-red-500/50 rounded-lg text-white">
                <i class="fas fa-exclamation-triangle mr-2"></i>
                <span id="errorMessage"></span>
            </div>
        </div>
        
        <footer class="text-center mt